<?php

namespace App\Models\V1;

use Illuminate\Database\Eloquent\Model;
use App\Scopes\V1\ValidDataScope;

class ForgetPassword extends Model
{
    /**
     * 模型启动函数
     */
    protected static function boot()
    {
        parent::boot();
        static::addGlobalScope(new ValidDataScope);
    }

    /**
     * 可被批量赋值字段（白名单）
     *
     * @var array
     */
    protected $fillable = [
        'code', 'newpassword', 'clientIP', 'auditor',
    ];

    /**
     * 获取登录用户对应的忘记密码信息
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function adminUser() {
        return $this->belongsTo(AdminUser::class,'code','code');
    }
}
